package jude.java.money.black;

import jude.java.money.beans.FtpSite;
import jude.java.money.provide.Provider;
import jude.java.money.spring.Services;
import jude.java.money.task.BaseTask;
import jude.java.money.tools.PageRank;

public class PageRankTask extends BaseTask<FtpSite> {
	
	public PageRankTask(Provider<FtpSite> provider) {
		super(provider);
	}

	@Override
	protected void execute(FtpSite site) {
		int pr = PageRank.getPageRank("http://" + site.getHost());
		if (pr == -2) {
			System.out.println("can't get pr: " + site.getHost());
		}
		site.setPr(pr);
		Services.getGlobalService().update(site);
	}

}
